import * as React from 'react';
import { createElement, forwardRef } from 'react';
import { Button } from '@alifd/next';
import './index.scss';

export interface ColorfulButtonProps {
  /**
   * 类型
   */
  type?: "primary" | "secondary" | "normal";
  color?: string;
  style?: React.CSSProperties;
  text: string;
  [key: string]: any;
}

const ColorfulButton = forwardRef<any, ColorfulButtonProps>(function ColorfulButton({
  type = 'primary',
  color,
  style = {},
  text,
  ...otherProps
}, ref) {
  const _style: React.CSSProperties = style || {};
  if (color) {
    _style.backgroundColor = color;
  }
  return (
    <Button ref={ref} type={type} style={_style} {...otherProps}>{text}</Button>
  );
});

ColorfulButton.displayName = 'ColorfulButton';

export default ColorfulButton;


